The results reported in the paper are produced partly in TSP and partly in Stata. The do-file commands assume that the data are stored in a folder named C:\TSPS.


CANADA

The following TSP do-files read the raw price data (in the excel files newcan1a.xls - newcan1p.xls) and construct the volatility and persistence measures. Each of the measures will be written in a TSP output file (*.out).

newcan0.tsp generates city and commodity index values for each observation

newcan1a.tsp generates the standard deviations of relative prices (sd(p)) for Canada

newcan1b.tsp generates the standard deviations of inflation (sd(Dp))	for Canada

newcan1c.tsp generates the persistence measures AR(1) for Canada

newcan1d.tsp generates the persistence measures AR(12a) and AR(12b) for Canada

In the data files newcan1a.xls-newcan1p.xls, the first row is a series identifier: i[m]c[n] is commodity m in city n; subsequent rows contain prices for each month.

The data file Canada_names.xls lists the city and commodity identifiers. (This file includes prices for two commodities, coal oil (53) and matches (54), which are not used in the data analysis because they exhibit little variation over time. St Johns QC is listed among the cities but not used in the data analysis, for reasons explained in the paper.)

The TSP do-file newcan1e.tsp takes the raw data on city latitude and longitude, provincial location and the proportion of people speaking English and French (in the excel file newcan1r.xls) and generates city distances in 1,000s of miles, a dummy variable for whether two cities are in the same province, and the probability that a person randomly drawn from the first city and a person randomly drawn from the second city will have at least one language in common. These measures will be written in a TSP output file (*.out).

In newcan1r.xls, each column corresponds to a city and each row to a variable:-

Row 1: the city identifier
Row 2: latitude
Row 3: longitude
Row 4: a province identifier
Row 5: total population
Row 6: population speaking English only
Row 7: population speaking French only
Row 8: population speaking English and French

The Stata file Canada.dta contains the variables produced by the TSP files:

item:  an index for the commodity
city1: an index for the first city in the pair
city2: an index for the second city in the pair
sdp:   the volatility measure sd(p)
sddp:  the volatility measure sd(Dp)
x1ar1: the persistence measure AR(1)
x1ar2: the persistence measure AR(12a)
x2ar2: the persistence measure AR(12b)
dist:	 the distance between the cities
prov:	 the same-province dummy
lang:	 the language similarity measure
obs:	 an index giving a unique value to each observation

Canada.dta also includes the following variables orthogonalized with respect to city-commodity fixed effects:  

sdpr:    orthogonalized sdp
sddpr:   orthogonalized sddp
x1ar1r:  orthogonalized x1ar1
x2ar2r:  orthogonalized x1ar2
x2ar2r:  orthogonalized x2ar2
dislr:   orthogonalized ln(dist)
dislsqr: orthogonalized ln(dist)^2
provr:   orthogonalized prov
langr:   orthogonalized lang

These variables are generated using the TSP files newcan2.tsp, which reads the non-orthogonalized variables from Canada.dta.

The do-file newcan9.do should be opened after Canada.dta in Stata. It produces a file newcan9.out which includes the following output for each volatility and persistence measure (sdp, sddp, x1ar1, x1ar2, x2ar2):

(i) The parameters in equation (3) for each commodity. These are produced by stacking the data and fitting a single OLS regression equation with different slope coefficients for each commodity. The regressions use the orthogonalized variables in the dataset, which is equivalent to a fixed-effects regression. 

(ii) The average parameter values across all commodities, as in Table 2 of the paper.

(iii) Average parameter values for perishables and non-perishables separately.

(iv) The difference between quadratic distance function values across perishables and non-perishables, computed at 200-mile intervals. (The values for sdp and x1ar2 are plotted in Figures 3-4 of the paper.)

The do-files semican1a.do-semican1e.do are to be used in conjunction with the data file Canada_semi.dta, which stores each volatility or persistence measure for each commodity in a separate column. The do-files generate the semi-parametric estimates of the distance functions for each persistence or volatility measure and for each commodity. The values for the average of these estimates over all commodities for sdp and x1ar2 are plotted in Figures 1-2 of the paper, and the data file cansemi.xls contains the corresponding series: sdp_[m]f (x1ar2_[m]f) is the distance function for sdp (x1ar2) for commodity m, sdp_perf (x1ar2_perf) is the average over all perishables, sdp_nprf (x1ar2nprf) is the average over non-perishables and sdp_allf (x1ar2_allf) is the overall average (as in the figure). 

NIGERIA

The following TSP do-files read the raw price data (in the excel files nig1.xls - nig19.xls) and construct the volatility and persistence measures. Each of the measures will be written in a TSP output file (*.out).

newnig0.tsp generates city and commodity index values for each observation

newnig1a.tsp generates the standard deviations of relative prices (sd(p)) for Nigeria

newnig1b.tsp generates the standard deviations of inflation (sd(Dp)) for Nigeria

newnig1c.tsp generates the persistence measures AR(1) for Nigeria

In the data files nig1.xls - nig19.xls, the first row is a series identifier: i[m]c[n] is commodity m in city n; subsequent rows contain prices for each month.

The data file Nigeria_names.xls lists the city and commodity identifiers. (The file contains the state names; in each case, the city in question is the state capital. The federal capital is also listed, but not used in the data analysis because of an absence of demographic data.) 

The TSP do-file newnig1e.tsp takes the raw data on city latitude and longitude, the proportion of people speaking English, Hausa, Ibo and Yoruba, and the proportion who are Christian, Muslim or other (in the excel file nig20.xls), and generates city distances in 1,000s of miles, the probability that a person randomly drawn from the first city and a person randomly drawn from the second city will have at least one indigenous language in common, the probability that they will both speak English, and the probability that they will be of the same religion. These measures will be written in a TSP output file (*.out).

In nig20.xls, each column corresponds to a city and each row to a variable:-

Row 1: the city identifier
Row 2: Muslim population (as a fraction of the total)
Row 3: Christian population (as a fraction of the total)
Row 4: latitude
Row 5: longitude
Row 6: population speaking English (as a fraction of the total)
Row 7: population speaking Hausa (as a fraction of the total)
Row 8: population speaking Ibo (as a fraction of the total)
Row 9: population speaking Yoruba (as a fraction of the total)

The Stata file Nigeria.dta contains the variables produced by the TSP files:

item: an index for the commodity
city1: an index for the first city in the pair
city2: and index for the second city in the pair
sdp: the volatility measure sd(p)
sddp: the volatility measure sd(Dp)
x1ar1: the persistence measure AR(1)
dist: the distance between the cities
reli: the religious similarity measure
engl: the shared English language measure
lang: the indigenous language similarity measure
obs: an index giving a unique value to each observation

Nigeria.dta also includes the following variables orthogonalized with respect to city and commodity fixed effects:  

sdpr: orthogonalized sdp
sddpr: orthogonalized sddp
x1ar1r: orthogonalized x1ar1
dislr: orthogonalized ln(dist)
dislsqr: orthogonalized ln(dist)^2
relir: orthogonalized reli
englr: orthogonalized engl
langr: orthogonalized lang

These variables are generated using the TSP files newnig2.tsp, which reads the raw variables from Nigeria.dta.

The do-file newnig9.do should be opened after Nigerida.dta in Stata. It produces a file newnig9.out which includes the following output for each volatility and persistence measure (sdp, sddp, x1ar1):

(i) The parameters in equation (4) for each commodity. These are produced by stacking the data and fitting a single OLS regression equation with different slope coefficients for each commodity. The regressions use the orthogonalized variables in the dataset, which is equivalent to a fixed-effects regression. 

(ii) The average parameter values across all commodities, as in Table 4 of the paper.

(iii) Average parameter values for perishables and non-perishables separately.

(iv) The difference between quadratic distance function values across perishables and non-perishables, computed at 50-mile intervals. (The values for sdp are plotted in Figure 7 of the paper.)

The do-files semican1a.do-semican1e.do are to be used in conjunction with the data file Nigeria_semi.dta, which stores each volatility or persistence measure for each commodity in a separate column. The do-files generate the semi-parametric estimates of the distance functions for each persistence or volatility measure and for each commodity. The values for the average of these estimates over all commodities for sdp and x1ar1 are plotted in Figures 5-6 of the paper, and the data file nigsemi.xls contains the corresponding series: sdp_[m]f (x1ar1_[m]f) is the distance function for sdp (x1ar1) for commodity m, sdp_perf (x1ar1_perf) is the average over all perishables, sdp_nprf (x1ar2nprf) is the average over non-perishables and sdp_allf (x1ar1_allf) is the overall average (as in the figure). 

